package com.hx.exception.serv;

import com.hx.exception.serv.TestService;
import com.hx.exception.tools.CatchEx;

/**
 * @author minghuachen
 * @since 2024/1/25 13:50
 */
public class ExceTest {
    public static void main(String[] args) {
        TestService testService = new TestService();

        String uid = null;

//        String execute = CatchEx.<String>defaults()
//                .onError(throwable -> System.out.println("出现异常"))
//                .recover(throwable -> "default")
//                .execute(() -> testService.getUserInfo(uid));
//        System.out.println(execute);
//
//        CatchEx.defaults()
//                .onError(throwable -> System.out.println("出现异常"))
//                .recover(throwable -> "default")
//                .executeVoid(() -> testService.logout(null));

        String execute = (String) CatchEx.defaults()
                .onError(throwable -> System.out.println("出现异常"))
                .recover(throwable -> "default")
                .execute(() -> testService.getUserInfo(uid));
        System.out.println(execute);


    }
}
